//=============================================================================
//
//   File : qtg_xml_reader.h
//   Creation date : Sab 19 mar 2011 09:31:42 CET by Antonino G.Imbesi
//
//   This file is part of the QtGLauncher distribution
//   Copyright (C) 2011 Antonino G. Imbesi <grifisx at barmes dot org>
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#ifndef QTG_XML_READER_H
#define QTG_XML_READER_H


class QIcon;
class QXmlStreamReader;
class QMap<class Key, class T>;
class QDebug;
class QTreeWidget;

class qtg_listviewitem;

class qtg_xml_reader
{
public:

    qtg_xml_reader(QTreeWidget *treeWidget);

    bool read(QIODevice *device);
    QString errorString() const;
    QStringList getAllCategoryNames();
    QStringList getSoftwareNodesByCategoryName(QString);
    QString m_szCategory;
    QString m_szSoftware;
    QMap<QString, QString> m_xmlMap;

private:

    void readXBEL();
    void readSeparator(qtg_QTreeWidgetItem *item);
    void readFolder(qtg_QTreeWidgetItem *item);
    void readBookmark(qtg_QTreeWidgetItem *item);
    // These functions are to emulate new xml functions in old QT
    bool xmlreadNextStartElement();
    void xmlskipCurrentElement();


    qtg_QTreeWidgetItem *createChildItem(qtg_QTreeWidgetItem *item);

    QXmlStreamReader *m_pXmlStream;
    QTreeWidget *m_pTreeWidget;
};


#endif // QTG_XML_READER_H

